this._containerDestroyedId = 0;
this._updateIconSizesLaterId = 0;
+
+ this._resolveOnIdleId = 0;
+ this._iconSizeUpdateResolveCbs = [];
}
_findBestIconSize() {
return isRtl ? rowAlign * -1 : rowAlign;
}
+ _runPostAllocation() {
+ if (this._iconSizeUpdateResolveCbs.length > 0 &&
+ this._resolveOnIdleId === 0) {
+ this._resolveOnIdleId = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
+ this._iconSizeUpdateResolveCbs.forEach(cb => cb());
+ this._iconSizeUpdateResolveCbs = [];
+ this._resolveOnIdleId = 0;
+ return GLib.SOURCE_REMOVE;
+ });
+ }
+ }
+
_onDestroy() {
if (this._updateIconSizesLaterId >= 0) {
Meta.later_remove(this._updateIconSizesLaterId);
this._updateIconSizesLaterId = 0;
}
+
+ if (this._resolveOnIdleId > 0) {
+ GLib.source_remove(this._resolveOnIdleId);
+ delete this._resolveOnIdleId;
+ }
}
vfunc_set_container(container) {
});
this._pageSizeChanged = false;
+
+ this._runPostAllocation();
}
/**
return itemData.pageIndex;
}
+ ensureIconSizeUpdated() {
+ if (this._updateIconSizesLaterId === 0)
+ return Promise.resolve();
+
+ return new Promise(
+ resolve => this._iconSizeUpdateResolveCbs.push(resolve));
+ }
+
adaptToSize(pageWidth, pageHeight) {
if (this._pageWidth === pageWidth && this._pageHeight === pageHeight)
return;
this.layout_manager.adaptToSize(width, height);
}
- animateSpring(animationDirection, sourceActor) {
+ async animateSpring(animationDirection, sourceActor) {
this._resetAnimationActors();
let actors = this._getChildrenToAnimate();
return;
}
+ await this.layout_manager.ensureIconSizeUpdated();
+
let [sourceX, sourceY] = sourceActor.get_transformed_position();
let [sourceWidth, sourceHeight] = sourceActor.get_size();
// Get the center